package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_UserAmount 用户账户
 *
 */
public class TestData_TB_UserAmount
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_UserAmount saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_User user
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_UserAmount");
		return (TB_UserAmount)repository.save(newMust(
				user
			));
	}
	
	public static TB_UserAmount newMust(
		bairui.international.model.domain.jpa.TB_User user
	){
		return new TB_UserAmount(new TB_UserAmount.MustProperties() {
			/** 用户 */
			@Override public bairui.international.model.domain.jpa.TB_User getUser(){
				return user;
			}
			/** 总积分 */
			@Override public Double getGrade(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_UserAmount saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_User user
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_UserAmount");
		return (TB_UserAmount)repository.save(newAll(
				user
			));
	}
	
	public static TB_UserAmount newAll(
		bairui.international.model.domain.jpa.TB_User user
	){
		return new TB_UserAmount(
			new TB_UserAmount.MustProperties() {
				/** 用户 */
				@Override public bairui.international.model.domain.jpa.TB_User getUser(){
					return user;
				}
				/** 总积分 */
				@Override public Double getGrade(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
			},
			new TB_UserAmount.OptionalSingleProperties() {
			}
		);
	}
	

}
